//
//  JKCellAppIndexBanner.m
//  chequanbao_ios
//
//  Created by 朱凯 on 2018/1/23.
//  Copyright © 2018年 com.itboye. All rights reserved.
//

#import "JKCellAppIndexBanner.h"

#import "ByModelIndexCarousel.h"

@implementation JKCellAppIndexBanner
{
//    ByViewDetailHeaderCarousel *_view;
    UIImageView *_view;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = TABLE_COLOR;
        
        _view = [[UIImageView alloc] init];
        _view.image = DEFAULT_IMAGE;
        [self.contentView addSubview:_view];
        
        [_view mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(10, 0, 10, 0));
        }];

    }
    return self;
}

- (void)setBanners:(NSArray *)banners {
    
    _banners = banners;
    
    if (banners.count != 0) {
        ByModelIndexCarousel *model = banners[0];
        [_view setImageWithURL:[NSURL URLWithString:BOYE_PICTURE_VIEW_URL(model.img)] placeholderImage:DEFAULT_IMAGE completed:nil];
    }
}
@end
